package com.sky.mapper;

import com.sky.entity.Dish;
import com.sky.entity.OrderDetail;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.ArrayList;
import java.util.List;

/**
 * @author iTaotao
 * @version 1.0
 * @Description
 * @createTime 2023年08月04日 11:41:00
 */
@Mapper
public interface OrderDetailMapper {

    /**
     * 批量插入
     *
     * @param details 细节
     */
    void insert(List<OrderDetail> details);

    /**
     * 选择列表按订单id
     *
     * @param ordersIds 订单id
     * @return {@link List}<{@link OrderDetail}>
     */
    List<OrderDetail> selectListByOrderIds(List<Long> ordersIds);

    List<Dish> selectDishByDishId(Long dishId);

    @Select("select * from order_detail where order_id = #{id}")
    List<OrderDetail> selectOrderDetailByOrderId(Long id);

    @Select("select * from  order_detail where order_id = #{id}")
    List<OrderDetail> selectOrderDetailByOrder(Long id);
}
